updating oE map put

put

include map.e 
namespace map 
public procedure put(map the_map_p, object key, object val, object op = PUT, 
        object deprecated = 0) 

adds or updates an entry on a map.

Parameters:
  1. the_map_p : the map where an entry is being added or updated
  2. the_key_p : an object, the the_key_p to look up
  3. the_value_p : an object, the value to add, or to use for updating.
  4. operation : an integer, indicating what is to be done with the_value_p. Defaults to PUT.
  5. trigger_p : Deprecated. This parameter defaults to zero and is not used.
Comments:
  • The operation parameter can be used to modify the existing value. Valid operations are:
    • PUT -- This is the default, and it replaces any value in there already
    • ADD -- Equivalent to using the += operator
    • SUBTRACT -- Equivalent to using the -= operator
    • MULTIPLY -- Equivalent to using the *= operator
    • DIVIDE -- Equivalent to using the /= operator
    • APPEND -- Appends the value to the existing data
    • CONCAT -- Equivalent to using the &= operator
    • LEAVE -- If it already exists, the current value is left unchanged otherwise the new value is added to the map.
Example 1:
map ages 
ages = new() 
put(ages, "Andy", 12) 
put(ages, "Budi", 13) 
put(ages, "Budi", 14) 
 
-- ages now contains 2 entries: "Andy" => 12, "Budi" => 14 
See Also:

remove, has, nested_put

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu